// 引入axios组件
import axios from 'axios';
import qs from 'qs'; // 处理数据  qs.stringify(params)
import { checkRule } from '@/assets/js/public';
// 引入公共js文件
export default {
  data() {
    return {
      // postage:'',
      // opaque:'',
    };
  },
  created() {
    this.$Spin.show();
    setTimeout(() => {
      this.$Spin.hide();
    }, 500);
  },
  computed: {
    websiteinfo() {
      return this.$store.state.waterInfo;
    },
    // postage(){
    //   return this.$store.state.waterInfo.addto;
    // }
  },
  methods: {
    // 图片上传回调钩子方法
    handleSuccess(response) {
      checkRule(response, this); // 检查是否有权限
      if (response.code == 1) {
        this.websiteinfo.water = response.imgpath;
        this.$Message.success('图片上传成功');
      } else {
        this.$Message.error('图片上传失败');
      }
    },

    // vue的ajax
    webSitePutData() {
      const self = this;
      axios({
        method: 'post',
        url: '/admin/Website/watermarkUpdate',
        data: qs.stringify({
          water: this.websiteinfo.water,
          addto: this.websiteinfo.addto,
          opaque: this.websiteinfo.opaque,
        }),
      })
        .then((response) => {
          checkRule(response, self); // 检查是否有权限
          if (response.data.code == 1) {
            self.$Message.success(response.data.msg);
          } else {
            self.$Message.error(response.data.msg);
          }
        })
        .catch((response) => {});
    },
  },
};
